import Vue from 'vue';
import store from '@/store';
import layout_config from '@/config/layout';
import {} from '@/config/index';
import {
  DEFAULT_COLOR,
  DEFAULT_THEME,
  DEFAULT_LAYOUT_MODE,
  DEFAULT_COLOR_WEAK,
  SIDEBAR_TYPE,
  DEFAULT_FIXED_HEADER,
  DEFAULT_FIXED_HEADER_HIDDEN,
  DEFAULT_FIXED_SIDEMENU,
  DEFAULT_CONTENT_WIDTH_TYPE,
  DEFAULT_MULTI_TAB
} from '@/store/mutation-types';

export default function Initializer() {
  // console.log(`API_URL: ${process.env.VUE_APP_API_BASE_URL}`)
  store.commit('SET_SIDEBAR_TYPE', Vue.ls.get(SIDEBAR_TYPE, true));
  store.commit('TOGGLE_THEME', Vue.ls.get(DEFAULT_THEME, layout_config.navTheme));
  store.commit('TOGGLE_LAYOUT_MODE', Vue.ls.get(DEFAULT_LAYOUT_MODE, layout_config.layout));
  store.commit('TOGGLE_FIXED_HEADER', Vue.ls.get(DEFAULT_FIXED_HEADER, layout_config.fixedHeader));
  store.commit('TOGGLE_FIXED_SIDERBAR', Vue.ls.get(DEFAULT_FIXED_SIDEMENU, layout_config.fixSiderbar));
  store.commit('TOGGLE_CONTENT_WIDTH', Vue.ls.get(DEFAULT_CONTENT_WIDTH_TYPE, layout_config.contentWidth));
  store.commit('TOGGLE_FIXED_HEADER_HIDDEN', Vue.ls.get(DEFAULT_FIXED_HEADER_HIDDEN, layout_config.autoHideHeader));
  store.commit('TOGGLE_WEAK', Vue.ls.get(DEFAULT_COLOR_WEAK, layout_config.colorWeak));
  store.commit('TOGGLE_COLOR', Vue.ls.get(DEFAULT_COLOR, layout_config.primaryColor));
  store.commit('TOGGLE_MULTI_TAB', Vue.ls.get(DEFAULT_MULTI_TAB, layout_config.multiTab));
  store.commit('SET_TOKEN', Vue.ls.get());
}
